/**
 * 飞行动画
 * @param {*} viewer 场景
 * @param {Array} location 经、纬度、高度
 * @param {*} orientation 旋转角度
 * @param {*} duration 飞行时间
 */
// export const flyTo = ({
//     viewer,
//     location,
//     orientation = {
//         heading: Cesium.Math.toRadians(0),
//         pitch: Cesium.Math.toRadians(-90),
//         roll: 0.0
//     },
//     duration = 3
// }) => {
//     viewer.camera.flyTo({
//         destination: new Cesium.Cartesian3.fromDegrees(...location),
//         orientation,
//         duration
//     });
// };

/**
 * 昼夜切换
 */
export const dayNightChange = (viewer) => {
    // const dayLayers = viewer.imageryLayers;
    // const nightLayer = dayLayers.get(0);
    // const dayLayer = dayLayers.get(1);

    viewer.scene.globe.enableLighting = true;
    //确定调用Clock#tick时前进的时间，负值允许向后前进。
    viewer.clock.multiplier = 5000;
    // nightLayer.dayAlpha = 0.0;
};

/**
 * 环境设置
 */
export default class Environment {
    viewer: any;
    constructor(viewer) {
        this.viewer = viewer;
    }
    openShadow() {
        //恢复照明的距离。启用以太阳为光源照亮地球
        this.viewer.scene.globe.enableLighting = true;
        //是否启用阴影贴图。
        this.viewer.scene.shadowMap.enabled = true;
    }
    reset() {
        this.viewer.scene.globe.enableLighting = false;
        this.viewer.scene.shadowMap.enabled = false;
    }
}
